<?php

class admin_template_system_app_listing extends admin_theme
{


	protected function center()
	{
	    $apps = $this->get('apps');
	    
		$ui_listing = bone::get_admin_ui('listing');

		$ui_listing->can('create', '安装新应用');
		$ui_listing->can('edit', '管理');
		$ui_listing->can('delete');
		
		foreach($apps as $app)
		{
		    $app->id = $app->name;
		    $app->success = $app->db_info->total==$app->db_info->created;
		}
		
		$ui_listing->set_data($apps);
		$ui_listing->set_footer('共 <strong>'.count($apps).'</strong> 个应用');
		
		$ui_listing->set_fields(
		    array(
    			'name'=>'icon',
    			'label'=>'',
    			'align'=>'center',
		        'template'=>'<img src="{icon}" />',
    		    'width'=>'30'
    		),
            array(
    			'name'=>'label',
    			'label'=>'名称',
    			'align'=>'left'
    		),
    		array(
    			'name'=>'version',
    			'label'=>'版本',
    			'align'=>'center',
    		    'width'=>'120'
    		),
            array(
    			'name'=>'name',
    			'label'=>'标识',
    			'align'=>'center',
    		    'width'=>'120'
    		),
    		array(
    			'name'=>'status',
    			'label'=>'完全安装',
    			'align'=>'center',
    		    'width'=>'80',
    			'template'=>'<a class="icon checked-{success}"></a>'
			)
		);
		$ui_listing->display();
	}	

}
?>